export const rules = {
  Name: {
    required: true,
    message: '请输入总表名称',
    trigger: 'change',
  },
  LimitLower: [{
    required: true,
    message: '请输入阈值',
    trigger: 'change',
  }, {
    message: '请输入数字',
    type: 'number',
    trigger: 'change',
  }],
  PointCode: {
    required: true,
    message: '请输入采集因子',
    trigger: 'change',
  },
  Location: {
    required: true,
    message: '请输入安装位置',
    trigger: 'change',
  },
}

interface DeviceStatus {
  status: string
  mark: string
  ObjID: string
}

export function useInitForm(): { formData: Ref<DeviceStatus>, initForm: () => void } {
  const getData = () => ({
    status: '',
    mark: '',
    ObjID: '',
  })
  const formData = ref<DeviceStatus>(getData())

  const initForm = () => {
    formData.value = getData()
  }

  return { formData, initForm }
}
